import * as Joi from "joi";

export { default as envConfig, ENV_FILE_PATH } from "./env.config";
export { ormConfig } from "./orm.config";
export { default as FieldConfig } from "./field.default.config";
export const ValidationSchema = Joi.object({
    NODE_ENV: Joi.string().valid("development", "production").default("development"),

    DB_PORT: Joi.number().default(3306),
    DB_HOST: Joi.string().ip(),
    DB_TYPE: Joi.string().valid("mysql", "postgres").default("mysql"),
    DB_DATABASE: Joi.string().required(),
    DB_USERNAME: Joi.string().required(),
    DB_PASSWORD: Joi.string().required(),
    DB_SYNC: Joi.boolean().default(false),

    USER_SECRET: Joi.string().required(),
    USER_TOKEN_EXPIRED: Joi.number().default(86400),
    FILE_SECRET: Joi.string().required(),
    FILE_TOKEN_EXPIRED: Joi.number().default(86400),

    MULTI_DEVICE_LOGIN: Joi.boolean().default(true),

    REDIS_HOST: Joi.string().ip(),
    REDIS_PORT: Joi.number().default(6379),
    REDIS_PASSWORD: Joi.string().optional(),

    HTTPS: Joi.boolean().default(false),
    HTTPS_PROT: Joi.number().default(3003),
    HTTP_PROT: Joi.number().default(3003),

    ENABLE_SWAGGER: Joi.boolean().default(false),

    ROOT_ADMIN_USER_NAME: Joi.string().default("admin"),
    ROOT_ADMIN_USER_PASS: Joi.string().default("1234"),

    QUERY_LIMIT: Joi.number().default(5),
    QUERY_PAGE: Joi.number().default(1),

    UPLOAD_DIR: Joi.string().default("upload"),

    CACHE_TTL: Joi.number().default(1440000),
});
